package com.har.modules.business.controller;

import com.har.common.utils.PageUtils;
import com.har.common.utils.R;
import com.har.modules.business.entity.TUserEntity;
import com.har.modules.business.service.TUserService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;


/**
 * 贷款产品
 *
 * @author macwy
 * @email
 * @date 2018-06-26 16:38:42
 */
@RestController
@RequestMapping("business/user")
public class UserController {
    @Autowired
    private TUserService userService;



    /**
     * 列表
     */
    @RequestMapping("/list")
    @RequiresPermissions("business:user:list")
    public R list(@RequestParam Map<String, Object> params){

        PageUtils page = userService.queryPage(params);

        return R.ok().put("page", page);
    }




    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    @RequiresPermissions("business:tuser:info")
    public R info(@PathVariable("id") Long id){
        TUserEntity tUserEntity = userService.selectById(id);

        return R.ok().put("tUser", tUserEntity);
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    @RequiresPermissions("business:tuser:update")
    public R update(@RequestBody TUserEntity tUserEntity){
        userService.updateAllColumnById(tUserEntity);//全部更新

        return R.ok();
    }







}
